package org.openanypcao.cs.util;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class StringUtil {

	/**
	 * 从异常信息中提取异常栈
	 * 
	 * @param e
	 * @return 字符串格式的异常栈
	 */
	public static String getTraceOfException(Throwable e) {
		ByteArrayOutputStream out = new ByteArrayOutputStream();
		e.printStackTrace(new PrintStream(out));
		return "\n" + out.toString();
	}
	
	/**
	 * 判断字符串是否为null或空字符串
	 * @param str
	 * @return
	 */
	public static boolean isBlank(String str){
		boolean tag = true;
		if(str != null && str.length() > 0){
			tag = false;
		}
		return tag;
	}
}
